package com.tencent.sr.iris.activity.restapi.activity;

import com.tencent.sr.iris.activity.interfaces.client.activity.ActivityAwardRecordClient;
import com.tencent.sr.iris.activity.interfaces.request.acticity.ActivityGiftPopupRequest;
import com.tencent.sr.iris.activity.interfaces.request.acticity.AwardConfirmRequest;
import com.tencent.sr.iris.activity.interfaces.response.activity.ActivityGiftPopupResponse;
import com.tencent.sr.iris.activity.service.activity.IrisActivityAwardRecordService;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 权益发放记录
 *
 * @author feiyyin
 * @date 2023/3/09 18:02
 */
@Api(tags = "权益发放记录", value = "权益发放记录相关接口")
@RestController
@RequestMapping(value = {"/api/v1/iris/iris-activity-core-service/task/award"})
public class ActivityAwardRecordController implements ActivityAwardRecordClient {

    @Resource
    private IrisActivityAwardRecordService activityAwardRecordService;

    /**
     * 权益弹窗
     *
     * @param request
     * @return
     */
    @Override
    public HttpResult<ActivityGiftPopupResponse> popup(ActivityGiftPopupRequest request) {
        ActivityGiftPopupResponse response = activityAwardRecordService.popup(request);
        return HttpResult.succ(response);
    }

    /**
     * 关闭弹窗
     *
     * @param request
     * @return
     */
    @Override
    public HttpResult<Boolean> closePopup(ActivityGiftPopupRequest request) {
        Boolean response = activityAwardRecordService.closePopup(request);
        return HttpResult.succ(response);
    }


    /**
     * 发奖校验
     *
     * @param request
     * @return
     */
    @Override
    public HttpResult<Boolean> awardConfirm(@Validated @RequestBody AwardConfirmRequest request) {
        Boolean response = activityAwardRecordService.awardConfirm(request);
        return HttpResult.succ(response);
    }
}
